package com.bat.domain.service;

import com.bat.domain.dao.RoleDao;
import com.bat.domain.entity.RoleEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;

/**
 * @Description:
 * @Author: zpf
 * @Date: 2020/1/15 下午4:52
 */
@Service
@Slf4j
public class RoleService {
    @Resource
    private RoleDao roleDao;
    @Resource
    private HomeService homeService;

    @Transactional(rollbackFor = Exception.class)
    public List insert() {
        RoleEntity roleEntity = new RoleEntity();
        roleEntity.setName(UUID.randomUUID().toString());
        roleDao.insert(roleEntity);
        return homeService.userList();
    }

}
